import java.util.Arrays;
import java.util.Scanner;
import java.util.Stack;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        String s = in.nextLine();
        String ret = Func(s);
        if(ret.length() == 0) {
            System.out.println(0);
        }
        System.out.println(ret);
    }
    public static String Func(String s) {
        //考虑使用栈来实现
        //进栈的时候 元素与栈顶元素对比 如果相邻的两个元素一样 那就出栈
        Stack<Character> stack = new Stack<>();
        char[] ch = s.toCharArray();
        int step = 0;
        stack.push(ch[step++]);
        while (step < ch.length) {
            if(stack.isEmpty()) {
                stack.push(ch[step++]);
            }
            if(step >= ch.length) {
                break;
            }
            char tmp = stack.peek();
            if(ch[step] == tmp) {
                stack.pop();
            } else {
                stack.push(ch[step]);
            }
            step++;
        }
        StringBuffer sb = new StringBuffer();
        while (!stack.isEmpty()) {
            sb.append(stack.pop());
        }
        sb.reverse();
        return sb.toString();
    }
}